﻿using System;
using System.Data;
using System.Linq;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{
    public partial class ITXEXRPT
    {

        private void JLTCOSTTOT(DataSet db)
        {
            /*MM	STAFF	KDKNAME	MDELQTY	RMBVALUE    WEFTTOT	COSTTOT	COSTTOTW*/
            try
            {
                DataTable dtSoruce = db.Tables["ICC_VKCOST"];
                DataTable dtOutput = new DataTable();
                dtOutput.Columns.Add("MM", typeof(System.String));
                dtOutput.Columns.Add("STAFF", typeof(System.String));
                dtOutput.Columns.Add("KDKNAME", typeof(System.String));
                dtOutput.Columns.Add("MDELQTY", typeof(System.String));
                dtOutput.Columns.Add("RMBVALUE", typeof(System.String));
                dtOutput.Columns.Add("WEFTTOT", typeof(System.String));
                dtOutput.Columns.Add("COSTTOT", typeof(System.String));
                dtOutput.Columns.Add("COSTTOTW", typeof(System.String));
                dtOutput.Merge(dtSoruce, false, MissingSchemaAction.Ignore);
                foreach (DataRow row in dtOutput.Rows)
                {
                    row["STAFF"] = GetGB2312Value(row["STAFF"].ToString());
                    row["KDKNAME"] = GetGB2312Value(row["KDKNAME"].ToString());                }
                exAgent.DataTableToExcel(dtOutput, 2, 1);

                int count = dtOutput.Rows.Count;
                exAgent.SetCellValue(1, 1, 1);
                exAgent.BatchConvert2Number(2, 4, count + 1, 8);
                exAgent.SetCellValue(1, 1, "月份");

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }
       }
}